﻿using System;
using System.Threading;
using Microsoft.SPOT;
using Microsoft.SPOT.Presentation;
using Microsoft.SPOT.Presentation.Controls;
using Microsoft.SPOT.Presentation.Media;
using Microsoft.SPOT.Touch;

using Gadgeteer.Networking;
using GT = Gadgeteer;
using GTM = Gadgeteer.Modules;

namespace CurrentSensorTestApp
{
    public partial class Program
    {

        GT.Timer timer;

        GTM.Seeed.CurrentSensor sensor = new GTM.Seeed.CurrentSensor(10);

        // This method is run when the mainboard is powered up or reset.   
        void ProgramStarted()
        {

            timer = new GT.Timer(200);
            timer.Tick += new GT.Timer.TickEventHandler(timer_Tick);
            timer.Start();

            // Use Debug.Print to show messages in Visual Studio's "Output" window during debugging.
            Debug.Print("Program Started");
        }

        void timer_Tick(GT.Timer timer)
        {
           //Debug.Print(sensor.GetCurrentReading().ToString());
            Debug.Print(sensor.GetCurrentPeak().ToString());//if you want get the effect value, you need to div to 1.414.
        }
    }
}
